package com.rabbitmqproducer.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TopicConfig {
	@Bean
	Queue firstQueue(){
		return new Queue("topic.First");
	}
	@Bean
	Queue secondQueue(){
		return new Queue("topic.Second");
	}
	@Bean
	TopicExchange topicExchange(){
		return new TopicExchange("topicExchange");
	}
	@Bean
	Binding bindingExchangeMessage1(){
		return BindingBuilder.bind(firstQueue()).to(topicExchange()).with("topic.First");
	}
	@Bean
	Binding bindingExchangeMessage2(){
		return BindingBuilder.bind(secondQueue()).to(topicExchange()).with("topic.#");
	}
}
